package com.ymatou.iapi.sellerquery.testcase;

import java.util.List;
import java.util.stream.Collectors;

import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;

import com.ymatou.query.seller.trading.api.parameter.FlowsDetail;
import com.ymatou.query.seller.trading.api.parameter.FundSummary;
import com.ymatou.query.seller.trading.api.parameter.GetOrderFlowsResult;
import com.ymatou.query.seller.trading.api.parameter.GetOrderFundDetailBean;
import com.ymatou.query.seller.trading.api.parameter.GetOrderFundDetailResponse;
import com.ymatou.query.seller.trading.api.parameter.Sp_GetOrderFundDetail_v1;
import com.ymatou.query.seller.trading.api.service.OrderCreate;
import com.ymt.core.tool.FormatUtil;
import com.ymt.core.tool.Logger;
import com.ymt.utils.annotation.TestCase;
import com.ymt.utils.annotation.TestSuite;
import com.ymt.utils.tag.P1;
import com.ymt.utils.tag.P3;
import com.ymttest.utils.DataUtil;
import com.ymttest.utils.EnvSetup;
import com.ymttest.utils.YMTDateUtil;
import com.ymttest.utils.constant.ECode;

/**
 * @date 2016-06-28
 * @author songyefeng
 * @desc 获取订单资金明细
 */
@TestSuite
public class Ts_GetOrderFundDetail {

	private static GetOrderFundDetailBean getOrderFundDetailBean;
	private static com.ymatou.query.seller.trading.api.service.GetOrderFundDetailCall getOrderFundDetailCall;
//	 private static com.ymatou.iapi.trading.sellerquery.service.GetOrderFundDetailCall getOrderFundDetailCall;

	@BeforeClass
	public static void setUp() {
		Logger.createResultFile("获取订单资金明细");
	}

	@Before
	public void caseUp() {
		getOrderFundDetailBean = new GetOrderFundDetailBean();
		getOrderFundDetailCall = new com.ymatou.query.seller.trading.api.service.GetOrderFundDetailCall();
//		getOrderFundDetailCall = new com.ymatou.iapi.trading.sellerquery.service.GetOrderFundDetailCall();
	}

	@AfterClass
	public static void tearDown() {
		Logger.generateResult(getOrderFundDetailCall.getOpurl());
	}

	@After
	public void caseDown() {
		Logger.end();
	}

	private void verify() {
		GetOrderFundDetailResponse expectedResponse = new GetOrderFundDetailResponse();
		ConstructExpectedResponse(expectedResponse);
		GetOrderFundDetailResponse actualResponse = getOrderFundDetailCall
				.getOrderFundDetailResponse();
		DataUtil.verifyEquals(expectedResponse.isOnlyNeedPayOnce(),
				actualResponse.isOnlyNeedPayOnce(), "验证OnlyNeedPayOnce");
		Logger.comment("************************开始验证Flows节点************************");
		List<FlowsDetail> expFlows = expectedResponse.getFlows();
		List<FlowsDetail> actFlows = actualResponse.getFlows();
		DataUtil.verifyEquals(expFlows.size(), actFlows.size(),
				"验证Flows.size()");
		for (FlowsDetail exp : expFlows) {
			// 精确到毫秒
			// boolean exists = actFlows.stream().anyMatch(
			// x -> YMTDateUtil.parseRespDate(x.getTime()).equals(
			// YMTDateUtil.parseRespDate(exp.getTime())));
			// 精确到秒
			boolean exists = actFlows.stream()
					.anyMatch(
							x -> YMTDateUtil.getBeforeOrNextDay(
									YMTDateUtil.parseRespDate(x.getTime()), 0)
									.equals(YMTDateUtil.getBeforeOrNextDay(
											YMTDateUtil.parseRespDate(exp
													.getTime()), 0))
									&& x.getAccountPaidAmount().compareTo(
											exp.getAccountPaidAmount()) == 0);
			DataUtil.verifyEquals(true, exists, "验证Time为:[" + exp.getTime()
					+ "]，且AccountPaidAmount=[" + exp.getAccountPaidAmount()
					+ "]的Flow对象是否在Flows中");
			if (exists) {
				FlowsDetail act = actFlows
						.stream()
						.filter(x -> YMTDateUtil
								.getBeforeOrNextDay(
										YMTDateUtil.parseRespDate(x.getTime()),
										0)
								.equals(YMTDateUtil.getBeforeOrNextDay(
										YMTDateUtil
												.parseRespDate(exp.getTime()),
										0))
								&& x.getAccountPaidAmount().compareTo(
										exp.getAccountPaidAmount()) == 0)
						.collect(Collectors.toList()).get(0);
				DataUtil.verifyDecimalEquals(exp.getAccountPaidAmount(),
						act.getAccountPaidAmount(), "验证Time为: " + exp.getTime()
								+ "的AccountPaidAmount");
				DataUtil.verifyDecimalEquals(exp.getThirdPartyPaidAmount(),
						act.getThirdPartyPaidAmount(),
						"验证Time为: " + exp.getTime() + "的ThirdPartyPaidAmount");
				DataUtil.verifyEquals(exp.getThirdPartyName(),
						act.getThirdPartyName(), "验证Time为: " + exp.getTime()
								+ "的ThirdPartyName");
				DataUtil.verifyEquals(exp.isIsIncoming(), act.isIsIncoming(),
						"验证Time为: " + exp.getTime() + "的IsIncoming");
				DataUtil.verifyEquals(exp.getOperation(), act.getOperation(),
						"验证Time为: " + exp.getTime() + "的Operation");
				DataUtil.verifyEquals(exp.getEvidence(), act.getEvidence(),
						"验证Time为: " + exp.getTime() + "的Evidence");
				DataUtil.verifyEquals(exp.getCouponChannel(),
						act.getCouponChannel(), "验证Time为: " + exp.getTime()
								+ "的CouponChannel");
				DataUtil.verifyEquals(exp.getCouponCode(), act.getCouponCode(),
						"验证Time为: " + exp.getTime() + "的CouponCode");
				DataUtil.verifyEquals(exp.getSellerCouponCode(),
						act.getSellerCouponCode(), "验证Time为: " + exp.getTime()
								+ "的SellerCouponCode");
				DataUtil.verifyDecimalEquals(exp.getFreeCard(),
						act.getFreeCard(), "验证Time为: " + exp.getTime()
								+ "的FreeCard");
				DataUtil.verifyDecimalEquals(exp.getPriceChange(),
						act.getPriceChange(), "验证Time为: " + exp.getTime()
								+ "的PriceChange");
				DataUtil.verifyDecimalEquals(exp.getTotal(), act.getTotal(),
						"验证Time为: " + exp.getTime() + "的Total");
				DataUtil.verifyDecimalEquals(exp.getCash(), act.getCash(),
						"验证Time为: " + exp.getTime() + "的Cash");
				DataUtil.verifyDecimalEquals(exp.getGift(), act.getGift(),
						"验证Time为: " + exp.getTime() + "的Gift");
				DataUtil.verifyDecimalEquals(exp.getCoupon(), act.getCoupon(),
						"验证Time为: " + exp.getTime() + "的Coupon");
				DataUtil.verifyDecimalEquals(exp.getSellerCoupon(),
						act.getSellerCoupon(), "验证Time为: " + exp.getTime()
								+ "的SellerCoupon");
				DataUtil.verifyDecimalEquals(exp.getFreight(),
						act.getFreight(), "验证Time为: " + exp.getTime()
								+ "的Freight");
			}
		}
		Logger.comment("************************完成开始验证Flows节点************************");

		Logger.comment("************************开始验证Summary节点************************");
		FundSummary expSum = expectedResponse.getSummary();
		FundSummary actSum = actualResponse.getSummary();
		DataUtil.verifyEquals(expSum == null, actSum == null, "验证Summary节点是否为空");
		if (actSum != null) {
			//第三方优惠总金额
			DataUtil.verifyDecimalEquals(expSum.getTotalThirdPartyDiscount(),
					actSum.getTotalThirdPartyDiscount(), "验证Summary节点的TotalThirdPartyDiscount");
			DataUtil.verifyDecimalEquals(expSum.getPaidCash(),
					actSum.getPaidCash(), "验证Summary节点的PaidCash");
			DataUtil.verifyDecimalEquals(expSum.getPaidGift(),
					actSum.getPaidGift(), "验证Summary节点的PaidGift");
			DataUtil.verifyDecimalEquals(expSum.getPaidFreeCard(),
					actSum.getPaidFreeCard(), "验证Summary节点的PaidFreeCard");
			DataUtil.verifyDecimalEquals(expSum.getPaidYmtCoupon(),
					actSum.getPaidYmtCoupon(), "验证Summary节点的PaidYmtCoupon");
			DataUtil.verifyDecimalEquals(expSum.getPaidSellerCoupon(),
					actSum.getPaidSellerCoupon(),
					"验证Summary节点的PaidSellerCoupon");
			DataUtil.verifyDecimalEquals(expSum.getPostPaidCash(),
					actSum.getPostPaidCash(), "验证Summary节点的PostPaidCash");
			DataUtil.verifyDecimalEquals(expSum.getPostPaidGift(),
					actSum.getPostPaidGift(), "验证Summary节点的PostPaidGift");
			DataUtil.verifyDecimalEquals(expSum.getTotalProductPrice(),
					actSum.getTotalProductPrice(),
					"验证Summary节点的TotalProductPrice");
			DataUtil.verifyDecimalEquals(expSum.getFirstPayProductPrice(),
					actSum.getFirstPayProductPrice(),
					"验证Summary节点的FirstPayProductPrice");
			DataUtil.verifyDecimalEquals(expSum.getFreight(),
					actSum.getFreight(), "验证Summary节点的Freight");
			DataUtil.verifyDecimalEquals(expSum.getOrderDiscount(),
					actSum.getOrderDiscount(), "验证Summary节点的OrderDiscount");
			DataUtil.verifyDecimalEquals(expSum.getPostPayDiscount(),
					actSum.getPostPayDiscount(), "验证Summary节点的PostPayDiscount");
			DataUtil.verifyDecimalEquals(expSum.getTotalRefundedCash(),
					actSum.getTotalRefundedCash(),
					"验证Summary节点的TotalRefundedCash");
			DataUtil.verifyDecimalEquals(expSum.getTotalRefundedGift(),
					actSum.getTotalRefundedGift(),
					"验证Summary节点的TotalRefundedGift");
			DataUtil.verifyDecimalEquals(expSum.getTotalRefundedYmtCoupon(),
					actSum.getTotalRefundedYmtCoupon(),
					"验证Summary节点的TotalRefundedYmtCoupon");
			DataUtil.verifyDecimalEquals(expSum.getTotalActivityPrice(),
					actSum.getTotalActivityPrice(),
					"验证Summary节点的TotalActivityPrice");
			DataUtil.verifyDecimalEquals(expSum.getTotalCanceledCash(),
					actSum.getTotalCanceledCash(),
					"验证Summary节点的TotalCanceledCash");
			DataUtil.verifyDecimalEquals(expSum.getTotalCanceledYmtCoupon(),
					actSum.getTotalCanceledYmtCoupon(),
					"验证Summary节点的TotalCanceledYmtCoupon");
		}
		Logger.comment("************************完成开始验证Summary节点************************");
	}

	private void ConstructExpectedResponse(GetOrderFundDetailResponse response) {
		Sp_GetOrderFundDetail_v1 sp = new Sp_GetOrderFundDetail_v1();
		sp.setOrderId(DataUtil.Integerr
				.GetValueOrDefault(getOrderFundDetailBean.getOrderId()));
		sp.setSummary(getOrderFundDetailBean.getSummary());
		sp.execute();
		GetOrderFlowsResult result = Convert(sp);
		response.setOnlyNeedPayOnce(!sp.isNeedPayTwiceOrMore());
		response.setFlows(result.getFlows());
		response.setSummary(result.getSummary());
	}

	private GetOrderFlowsResult Convert(Sp_GetOrderFundDetail_v1 sp) {
		GetOrderFlowsResult o = new GetOrderFlowsResult();
		o.setFlows(sp.getFundDetails());
		o.setSummary(sp.getSummary());
		return o;
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_001() {
		Logger.start(true, "获取订单资金明细, summary=true, iTradingStatus=4");
		try {
			Logger.comment("准备订单数据");
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create4_ReceivedOrder(userId, sellerId)
					.getiOrderId();
			Logger.comment("完成准备订单数据");
			
			getOrderFundDetailBean.setOrderId(orderId);
			getOrderFundDetailBean.setSummary(true);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals(ECode.SUCCESS,
					getOrderFundDetailCall.getCode(), "验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_002() {
		Logger.start(true, "获取订单资金明细, summary=false");
		try {
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create4_ReceivedOrder(userId, sellerId)
					.getiOrderId();
			getOrderFundDetailBean.setOrderId(orderId);
			getOrderFundDetailBean.setSummary(false);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("200", getOrderFundDetailCall.getCode(),
					"验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_003() {
		Logger.start(true, "获取订单资金明细, summary=false, iTradingStatus=1");
		try {
			Logger.comment("准备订单数据");
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create1_M2cOrder(userId, sellerId).getiOrderId();
			Logger.comment("完成准备订单数据");
			getOrderFundDetailBean.setOrderId(orderId);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.setData(getOrderFundDetailBean);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("200", getOrderFundDetailCall.getCode(),
					"验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_004() {
		Logger.start(true, "获取订单资金明细, summary=true, iTradingStatus=2");
		try {
			Logger.comment("准备订单数据");
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create2_PayOrder(userId, sellerId).getiOrderId();
			Thread.sleep(2000l);
			Logger.comment("完成准备订单数据");
			getOrderFundDetailBean.setOrderId(orderId);
			getOrderFundDetailBean.setSummary(true);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("200", getOrderFundDetailCall.getCode(),
					"验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_005() {
		Logger.start(true, "获取订单资金明细, summary=false, iTradingStatus=3");
		try {
			Logger.comment("准备订单数据");
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create3_ShippedOrder(userId, sellerId)
					.getiOrderId();
			Logger.comment("完成准备订单数据");
			getOrderFundDetailBean.setOrderId(orderId);
			getOrderFundDetailBean.setSummary(false);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("200", getOrderFundDetailCall.getCode(),
					"验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_006() {
		Logger.start(true, "获取订单资金明细, summary=false, iTradingStatus=12");
		try {
			Logger.comment("准备订单数据");
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create12_UserCancelOrder(userId, sellerId)
					.getiOrderId();
			Thread.sleep(1000l);
			Logger.comment("完成准备订单数据");
			getOrderFundDetailBean.setOrderId(orderId);
			getOrderFundDetailBean.setSummary(false);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("200", getOrderFundDetailCall.getCode(),
					"验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_007() {
		Logger.start(true, "获取订单资金明细, summary=true, iTradingStatus=13");
		try {
			Logger.comment("准备订单数据");
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create13_SellerCancelOrder(userId, sellerId)
					.getiOrderId();
			Thread.sleep(1000l);
			Logger.comment("完成准备订单数据");
			getOrderFundDetailBean.setOrderId(orderId);
			getOrderFundDetailBean.setSummary(true);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("200", getOrderFundDetailCall.getCode(),
					"验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_008() {
		Logger.start(true, "获取订单资金明细, summary=true, iTradingStatus=18");
		try {
			Logger.comment("准备订单数据");
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create18_SystemCancelOrder(userId, sellerId)
					.getiOrderId();
			Thread.sleep(1000l);
			Logger.comment("完成准备订单数据");
			getOrderFundDetailBean.setOrderId(orderId);
			getOrderFundDetailBean.setSummary(true);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("200", getOrderFundDetailCall.getCode(),
					"验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_009() {
		Logger.start(true, "获取订单资金明细, summary=false, iTradingStatus=101");
		try {
			Logger.comment("准备订单数据");
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create101_WaitPostPayOrder(userId, sellerId)
					.getiOrderId();
			Logger.comment("完成准备订单数据");
			getOrderFundDetailBean.setOrderId(orderId);
			getOrderFundDetailBean.setSummary(false);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("200", getOrderFundDetailCall.getCode(),
					"验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_010() {
		Logger.start(true, "获取订单资金明细, summary=false, iTradingStatus=16");
		try {
			Logger.comment("准备订单数据");
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create16_ApplyForPostPayOrder(userId, sellerId)
					.getiOrderId();
			Logger.comment("完成准备订单数据");
			getOrderFundDetailBean.setOrderId(orderId);
			getOrderFundDetailBean.setSummary(false);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("200", getOrderFundDetailCall.getCode(),
					"验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_011() {
		Logger.start(true, "获取订单资金明细, summary=false, iTradingStatus=17");
		try {
			Logger.comment("准备订单数据");
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create17_AcceptOrder(userId, sellerId)
					.getiOrderId();
			Logger.comment("完成准备订单数据");
			getOrderFundDetailBean.setOrderId(orderId);
			getOrderFundDetailBean.setSummary(false);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("200", getOrderFundDetailCall.getCode(),
					"验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_012() {
		Logger.start(true, "获取订单资金明细, summary=null");
		try {
			Logger.comment("准备订单数据");
			OrderCreate o = new OrderCreate();
			int sellerId = Integer.valueOf(EnvSetup.getData("SellerId"));
			int userId = Integer.valueOf(EnvSetup.getData("BuyUserId"));
			int orderId = o.create17_AcceptOrder(userId, sellerId)
					.getiOrderId();
			Logger.comment("完成准备订单数据");
			getOrderFundDetailBean.setOrderId(orderId);
			getOrderFundDetailBean.setSummary(null);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("200", getOrderFundDetailCall.getCode(),
					"验证code");
			verify();
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_014() {
		Logger.start(true, "获取订单资金明细, orderId=null");
		try {
			getOrderFundDetailBean.setOrderId(null);
			getOrderFundDetailBean.setSummary(null);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("400", getOrderFundDetailCall.getCode(),
					"验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P1.class)
	@TestCase
	public void Tc_GetOrderFundDetail_015() {
		Logger.start(true, "获取订单资金明细, orderId不存在");
		try {
			getOrderFundDetailBean.setOrderId(404);
			getOrderFundDetailBean.setSummary(null);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("500", getOrderFundDetailCall.getCode(),
					"验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}

	@Test
	@Category(P3.class)
	@TestCase
	public void Tc_GetOrderFundDetail_016() {
		Logger.start(true, "获取订单资金明细, orderId=0");
		try {
			getOrderFundDetailBean.setOrderId(0);
			getOrderFundDetailBean.setSummary(null);
			String param = FormatUtil.beanToHttpString(getOrderFundDetailBean,
					true, false);
			getOrderFundDetailCall.setData(param);
			getOrderFundDetailCall.callService();
//			Logger.comment("getOrderFundDetailCall send:"
//					+ getOrderFundDetailCall.getEntityString());
//			Logger.comment("getOrderFundDetailCall response:"
//					+ getOrderFundDetailCall.getReturnData());
			Logger.verifyEquals("400", getOrderFundDetailCall.getCode(),
					"验证code");
		} catch (Exception e) {
			Logger.fail(e);
		}
	}
}